﻿using System;
using System.Diagnostics;
using Odin.Contracts.Services;

namespace Odin.Execution.Services
{
	public class ProcessService : IProcessService
	{
		public int Start(string filename, string arguments)
		{
			var startInfo = new ProcessStartInfo
			                	{
			                		FileName = filename,
			                		Arguments = arguments
			                	};
			var process = Process.Start(startInfo);
			return process.Id;
		}

		public void Kill(int processId)
		{
			var process = Process.GetProcessById(processId);
			process.Kill();
		}
	}
}
